package com.sub.framework.rabbitmq;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.sub.common.proto.DataProto;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;

import java.io.UnsupportedEncodingException;

/**
 *  基本消息模型- 消费者
 */
//@Component
public class BasicConsumer {

    private static final Logger log = LoggerFactory.getLogger(BasicConsumer.class);

    @Autowired
    private ObjectMapper objectMapper;

//    @RabbitListener(containerFactory = "singleListenerContainer" ,bindings = { @QueueBinding( value = @Queue(value = "wootop.test2",durable = "true") ,exchange=  @Exchange(type = "topic", value = "wootop.monitor.topic" ,durable = "true" ) , key = "wootop.ecg.1951")})
    public  void consumeMsg(@Payload DataProto.Content msg){
        DataProto.Content message = msg;
        log.info("基本消息模型- 消费者-监听消息：{}",message);
    }
}
